class Storage {
  setStorage(name, data) {
    try {
      uni.setStorageSync(name, data)
    } catch (err) {
      console.log(err)
    }
  }
  //从本地缓存中读取置顶name对应的内容
  getStorage(name) {
    let data
    try {
      data = uni.getStorageSync(name)
    } catch (e) {
      console.log(e)
    }
    return data
  }

  //从本地缓存中移出指定key
  removeStorage(name) {
    try {
      uni.removeStorageSync(name)
    } catch (e) {
      console.log(e)
    }
  }
  //清除本地数据缓存
  clearStorage() {
    try {
      uni.clearStorageSync()
    } catch (e) {
      console.log(e)
    }
  }
}

export default new Storage()
